﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Inspired.Euler.Tests
{
    /// <summary>
    /// Tests for problems from 20 to 29
    /// </summary>
    [TestClass]
    public class Problems020To029
    {
        [TestMethod]
        [Description("Find the sum of digits in 100!")]
        public void Problem020()
        {
            Assert.AreEqual(648, Euler.Problem020.Solve());
        }
 
        [TestMethod]
        [Description("Evaluate the sum of all amicable pairs under 10000.")]
        public void Problem021()
        {
            Assert.AreEqual(31626, Euler.Problem021.Solve());
        }
 
        [TestMethod]
        [Description("What is the total of all the name scores in the file of first names?")]
        public void Problem022()
        {
            Assert.AreEqual(871198282, Euler.Problem022.Solve());
        }
 
        [TestMethod]
        [Description("Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.")]
        public void Problem023()
        {
            Assert.AreEqual(4179871, Euler.Problem023.Solve());
        }
 
        [TestMethod]
        [Description("What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?")]
        public void Problem024()
        {
            Assert.AreEqual(2783915460, Euler.Problem024.Solve());
        }
 
        [TestMethod]
        [Description("What is the first term in the Fibonacci sequence to contain 1000 digits?")]
        public void Problem025()
        {
            Assert.AreEqual(4782, Euler.Problem025.Solve());
        }
 
        [TestMethod]
        [Description("Find the value of <i>d</i> &lt; 1000 for which 1/<i>d</i> contains the longest recurring cycle.")]
        public void Problem026()
        {
            Assert.AreEqual(-1, Euler.Problem026.Solve());
        }
 
        [TestMethod]
        [Description("Find a quadratic formula that produces the maximum number of primes for consecutive values of <i>n</i>.")]
        public void Problem027()
        {
            Assert.AreEqual(-59231, Euler.Problem027.Solve());
        }
 
        [TestMethod]
        [Description("What is the sum of both diagonals in a 1001 by 1001 spiral?")]
        public void Problem028()
        {
            Assert.AreEqual(669171001, Euler.Problem028.Solve());
        }
 
        [TestMethod]
        [Description("How many distinct terms are in the sequence generated by <i>a<sup>b</sup></i> for 2 &le; <i>a</i> &le; 100 and 2 &le; <i>b</i> &le; 100?")]
        public void Problem029()
        {
            Assert.AreEqual(9183, Euler.Problem029.Solve());
        }
     }
}
